package com.itheima.homework;

import java.util.ArrayList;

public class demo {
    public static void main(String[] args){
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<Person> list2 = new ArrayList<>();
        ArrayList<Student> list3 = new ArrayList<>();
        ArrayList<JavaStudent> list4 = new ArrayList<>();
        ArrayList<UIStudent> list5 = new ArrayList<>();
        ArrayList<Teacher> list6 = new ArrayList<>();
        ArrayList<JavaTeacher> list7 = new ArrayList<>();
        ArrayList<UITeacher> list8 = new ArrayList<>();

        //注意 : 泛型不支持多态 !!!
//        print1(list1);// 报错 , 泛型不支持多态
    }

    //要求：参数可以接收任何泛型的ArrayList参数
    public void show1(ArrayList<?> li){}

    //要求：参数可以接收任何Person及其子类泛型的ArrayList参数
    public void show2(ArrayList<? extends Person> li){}
    //要求：参数可以接收任何Student及其子类泛型的ArrayList参数
    public void show3(ArrayList<? extends Student> li){}
    //要求：参数可以接收任何Java学员，及其父类泛型的ArrayList参数
    public void show4(ArrayList<? super JavaStudent> li){}
}

class Person{}
class Student extends Person{}
class JavaStudent extends Student{}
class UIStudent extends Student{}
class Teacher extends Person{}
class JavaTeacher extends Teacher{}
class UITeacher extends Teacher{}

